import request from '@/utils/request'




// 获取正负面信息趋势图
export function getSentimentByPublishTime(query) {
  return request({
    url: '/system/opinion/getSentimentByPublishTime',
    method: 'get',
    params: query
  })
}


// 获取舆情热词
export function getHotWordsSystem(query) {
  return request({
    url: '/system/opinion/getHotWords',
    method: 'get',
    params: query
  })
}




// 查询负面舆情
export function negativeInformationHeatMap(query) {
  return request({
    url: '/system/opinion/negativeInformationHeatMap',
    method: 'get',
    params: query,
  })
}


// 查询舆情列表
export function listOpinion(query) {
  return request({
    url: '/system/opinion/list',
    method: 'get',
    params: query
  })
}


// 查询舆情列表
export function queryListOpinion(params,data) {
  return request({
    url: '/system/opinion/queryListOpinion',
    method: 'post',
    params: params,
    data: data
  })
}


// 查询舆情详细
export function getOpinion(id) {
  return request({
    url: '/system/opinion/' + id,
    method: 'get'
  })
}

// 获取舆情热词
export function getHotWords(id) {
  return request({
    url: '/system/opinion/getHotWords/' + id,
    method: 'get'
  })
}


// 获取关联人物
export function getRelationPersonNames(id) {
  return request({
    url: '/system/opinion/getRelationPersonNames/' + id,
    method: 'get'
  })
}



// 获取关联地域
export function getRelationLocationNames(id) {
  return request({
    url: '/system/opinion/getRelationLocationNames/' + id,
    method: 'get'
  })
}



// 获取关联机构
export function getRelationOrganizationNames(id) {
  return request({
    url: '/system/opinion/getRelationOrganizationNames/' + id,
    method: 'get'
  })
}




// 同作者文章
export function getOpinionsOfSameAuthorById(queryParams,id) {
  return request({
    url: '/system/opinion/getOpinionsOfSameAuthorById/' + id,
    method: 'get',
    params: queryParams
  })
}

// 相似文章
export function getOpinionsOfSimilarArticlesById(queryParams,id) {
  return request({
    url: '/system/opinion/getOpinionsOfSimilarArticlesById/' + id,
    method: 'get',
    params: queryParams
  })
}





// 新增舆情
export function addOpinion(data) {
  return request({
    url: '/system/opinion',
    method: 'post',
    data: data
  })
}

// 修改舆情
export function updateOpinion(data) {
  return request({
    url: '/system/opinion',
    method: 'put',
    data: data
  })
}

// 删除舆情
export function delOpinion(id) {
  return request({
    url: '/system/opinion/' + id,
    method: 'delete'
  })
}

// 导出舆情
export function exportOpinion(query) {
  return request({
    url: '/system/opinion/export',
    method: 'get',
    params: query
  })
}

// 根据ID导出舆情
export function exportOpinionByIds(query) {
  return request({
    url: '/system/opinion/export/'+query.ids,
    method: 'get',
  })
}

// 移除预警
export function removeTheForecast(query) {
  return request({
    url: '/system/opinion/removeTheForecast/'+query.ids,
    method: 'get',
  })
}

// 获取事件相关统计图(匿名)
export function getEventEchartsAnonymous(query) {
  return request({
    url: '/system/opinion/getEventEchartsAnonymous/'+query.eventId,
    method: 'get',
    params: query
  })
}

// 获取预警舆情分页数据
export function queryWarningList(page,query) {
  return request({
    url: '/system/opinion/queryWarningList',
    method: 'post',
    params: page,
    data: query
  })
}

// 获取预警舆情数量按媒体类型
export function getForecastMediaType(data) {
  return request({
    url: `/system/opinion/getForecastMediaType`,
    method: 'post',
    data: data
  })
}


// 查询最新的前多少条舆情
export function getNewestOpinion(query) {
  return request({
    url: '/system/opinion/newest',
    method: 'get',
    params: query
  })
}



// 加入收藏
export function addToFavorites(query) {
  return request({
    url: '/system/opinion/addToFavorites/'+query.ids,
    method: 'get',
    params: query
  })
}


// 收藏列表
export function getFavorites(query) {
  return request({
    url: '/system/opinion/getFavorites',
    method: 'get',
    params: query
  })
}

// 移除收藏
export function removeFavorites(query) {
  return request({
    url: '/system/opinion/removeFavorites/'+query.ids,
    method: 'get',
    params: query
  })
}


// 查询预警总数
export function getWarningCount(query) {
  return request({
    url: '/system/opinion/getWarningCount',
    method: 'get',
    params: query,
  })
}




// 正负面信息趋势
export function informationTrendsOfEmotion(query) {
  return request({
    url: '/system/opinion/informationTrendsOfEmotion',
    method: 'get',
    params: query,
  })
}






// 负面舆情
export function getNegativePublicOpinion(query) {
  return request({
    url: '/system/opinion/getNegativePublicOpinion',
    method: 'get',
    params: query,
  })
}


// 热点舆情
export function hotPublicOpinion(query) {
  return request({
    url: '/system/opinion/hotPublicOpinion',
    method: 'get',
    params: query,
  })
}





// 年度综合分析
export function comprehensiveStatisticsThisYear(query) {
  return request({
    url: '/system/opinion/comprehensiveStatisticsThisYear',
    method: 'get',
    params: query,
  })
}


// 查询舆情列表
export function queryOpinionByDataServer(query,params) {
  return request({
    url: '/system/opinion/queryOpinionByDataServer',
    method: 'post',
    data: query,
    params:params
  })
}
// 从数据中心下载数据到Es
export function downloadDataFromServeCenter(query,params) {
  return request({
    url: '/system/opinion/downloadDataFromServeCenter',
    method: 'post',
    data: query,
    params:params
  })
}

// 从数据中心下载Csv数据到本地
export function downloadCsvDataFromServeCenter(query,params) {
  return request({
    url: '/system/opinion/downloadCsvDataFromServeCenter',
    method: 'post',
    data: query,
    params:params
  })
}






